package com.sunk.test;

import com.sunk.appconfig.AppConfig;
import com.sunk.services.AServices;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.transaction.annotation.Transactional;

import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

//@EnableTransactionManagement
public class AppStart {
	public static void main(String[] args) throws InterruptedException {


//		int[] a=new int[]{1,2,3,4};
//		int[] b=new int[]{1,2,3,4};
//		System.out.println(a);
//		System.out.println(b);
//		while (true){
//			map.put(new int[1024][1024],"2");
//		}
//		ExecutorService executorService = Executors.newFixedThreadPool(2);
//		while (true){
//			executorService.submit(()->{
//				System.out.println(Thread.currentThread().getName());
//				try {
//					Thread.sleep(3000);
//				} catch (InterruptedException e) {
//					e.printStackTrace();
//				}
//			});
//		}
//		int[] arrays =new int[]{2,1,3,5};
//		int index=0;
//		int size=0;
//		while(index>=0 &&index <=arrays.length-1&&size<=arrays.length){
//			index=index+arrays[index];
//			size++;
//		}
//		if(size>arrays.length){
//			System.out.println(false);
//		}else{
//			System.out.println(true);
//		}
//		AnnotationConfigApplicationContext ac =
//				new AnnotationConfigApplicationContext(AppConfig.class);
//		AServices bean = ac.getBean(AServices.class);
//		bean.AA(1);
//		System.out.println(1);
//		ClassPathXmlApplicationContext cp=new ClassPathXmlApplicationContext("classpath:spring.xml");
//		System.out.println(ac.getBean(AppConfig.class));
//		GenericBeanDefinition genericBeanDefinition=new GenericBeanDefinition();
//		genericBeanDefinition.setScope("singleton");
//		genericBeanDefinition.setAutowireMode(AutowireCapableBeanFactory.AUTOWIRE_BY_TYPE);
//		ac.getBean("");
//		BeanDefinition beanDefinition = ac.getBeanDefinition("");
//		beanDefinition.getAttribute("s");
//		beanDefinition.getSource();
//		Enhancer enhancer = new Enhancer();
//		enhancer.setSuperclass(AServices.class);
//		enhancer.setUseFactory(false);
//		enhancer.setCallback(new MyMethodInterceptor());
//		enhancer.setCallbackType(MyMethodInterceptor.class);
//		AServices o = (AServices)enhancer.create();
//		o.AA(21);
//		System.out.println(o);
	}
	public static void findTwo(int[] nums){
		Map<Integer,Integer> map=new HashMap();
		for(int i=0;i<nums.length;i++){
			int num=map.get(nums[i]);
			if(map.get(nums[i])!=null){
				map.put(nums[i],1);
			}else{
				map.put(nums[i],1);
			}
		}
	}
}
